com.ftdi.j2xx.interfaces

## Interface I2cMaster

- All Known Implementing Classes:
    FT_4222_I2c_Master

      public interface I2cMaster

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getStatus(int deviceAddress, byte[] controllerStatus)` Read the status of the I2C master controller.
    `int` | `init(int kbps)` Initialize the device as I2C master with the requested I2C speed.
    `int` | `read(int deviceAddress, byte[] buffer, int sizeToTransfer, int[] sizeTransferred)` Read data from the specified I2C slave device with START and STOP conditions.
    `int` | `readEx(int deviceAddress, int flag, byte[] buffer, int sizeToTransfer, int[] sizeTransferred)` Read data from the specified I2C slave device with the specified I2C condition.
    `int` | `reset()` Reset the I2C master device.
    `int` | `write(int deviceAddress, byte[] buffer, int sizeToTransfer, int[] sizeTransferred)` Write data to the specified I2C slave device with START and STOP conditions
    `int` | `writeEx(int deviceAddress, int flag, byte[] buffer, int sizeToTransfer, int[] sizeTransferred)` Write data to the specified I2C slave device with the specified I2C condition.

- - ### Method Detail

    - #### init

          int init(int kbps)

      Initialize the device as I2C master with the requested I2C speed.
      Parameters:
        `kbps` - The speed of I2C transmission.
      Returns:
        0 if successful, otherwise the return value is an FT error code.

    - #### reset

          int reset()

      Reset the I2C master device.
      Returns:
        0 if successful, otherwise the return value is an FT error code.

    - #### read

          int read(int deviceAddress,
                 byte[] buffer,
                 int sizeToTransfer,
                 int[] sizeTransferred)

      Read data from the specified I2C slave device with START and STOP conditions.
      Parameters:
        `deviceAddress` - Address of the target I2C slave.
        `buffer` - Buffer array that receives the data from the device.
        `sizeToTransfer` - Number of bytes to read from the device.
        `sizeTransferred` - The actual number of bytes read from the device.
      Returns:
        0 if successful, otherwise the return value is an FT error code.

    - #### readEx

          int readEx(int deviceAddress,
                   int flag,
                   byte[] buffer,
                   int sizeToTransfer,
                   int[] sizeTransferred)

      Read data from the specified I2C slave device with the specified I2C condition.
      Parameters:
        `deviceAddress` - Address of the target I2C slave.
        `flag` - The I2C condition will be sent with this I2C transaction. flags is a bit-mask of `I2C_MasterFlag#NONE`, `I2C_MasterFlag#START`, `I2C_MasterFlag#Repeated_START`, `I2C_MasterFlag#STOP` and `I2C_MasterFlag#START_AND_STOP`.
        `buffer` - Buffer array that receives the data from the device.
        `sizeToTransfer` - Number of bytes to read from the device.
        `sizeTransferred` - The actual number of bytes read from the device.
      Returns:
        0 if successful, otherwise the return value is an FT error code.

    - #### write

          int write(int deviceAddress,
                  byte[] buffer,
                  int sizeToTransfer,
                  int[] sizeTransferred)

      Write data to the specified I2C slave device with START and STOP conditions
      Parameters:
        `deviceAddress` - Address of the target I2C slave.
        `buffer` - Buffer array that contains the data to be written to the device.
        `sizeToTransfer` - Number of bytes to write to the device.
        `sizeTransferred` - The actual number of bytes written to the device.
      Returns:
        0 if successful, otherwise the return value is an FT error code.

    - #### writeEx

          int writeEx(int deviceAddress,
                    int flag,
                    byte[] buffer,
                    int sizeToTransfer,
                    int[] sizeTransferred)

      Write data to the specified I2C slave device with the specified I2C condition.
      Parameters:
        `deviceAddress` - Address of the target I2C slave.
        `flag` - The I2C condition will be sent with this I2C transaction. flags is a bit-mask of `I2C_MasterFlag#NONE`, `I2C_MasterFlag#START`, `I2C_MasterFlag#Repeated_START`, `I2C_MasterFlag#STOP` and `I2C_MasterFlag#START_AND_STOP`.
        `buffer` - Buffer array that contains the data to be written to the device.
        `sizeToTransfer` - Number of bytes to write to the device.
        `sizeTransferred` - The actual number of bytes written to the device.
      Returns:
        0 if successful, otherwise the return value is an FT error code.

    - #### getStatus

          int getStatus(int deviceAddress,
                      byte[] controllerStatus)

      Read the status of the I2C master controller. This can be used to poll a slave until its write-cycle is complete.
      Parameters:
        `deviceAddress` - Address of the target I2C slave.
        `controllerStatus` - Buffer array that contains the to be return status data.
      Returns:
        0 if successful, otherwise the return value is an FT error code.

About FTDI | FTDI Licence Terms